class Movie < ActiveRecord::Base
    has_and_belongs_to_many :tags

    validates_presence_of :title
    validates_uniqueness_of :title, :message => 'suggests that this movie is already in store.'

    def tags_list
        if tags.empty?
            return ''
        end
        list = tags.first.name.to_s
        tags[1..tags.size].each {|tag| list += ', ' + tag.name.to_s}
        list
    end
end
